#ifndef __TEXTMENU_H__
#define __TEXTMENU_H__

#include "u8g2.h"

#define MAX_MENU                12
#define TEXT_HEIGHT             16
#define TEXT_WIDTH_OFFSET       2
#define BOX_HEIGHT              TEXT_HEIGHT
#define LCD_WIDTH               128
#define MENUS_IN_ONEPAGE        4                   // (16 pixel height for menu text)

#define OLED_HEIGHT             64
#define OLED_WIDTH              128


#define min(a, b)               (((a) < (b)) ? (a) : (b))

typedef unsigned char (*pFunc)(void);

typedef struct _textMenu_t {
    const char *pTmenuList[MAX_MENU];
    unsigned char textMenuSize;
    char curMenuID;
    pFunc KeyUpCheck;
    pFunc KeyUpCallback;
    pFunc KeyDownCheck;
    pFunc KeyDownCallback;
    pFunc KeyLeftCheck;
    pFunc KeyLeftCallback;
    pFunc KeyRightCheck;
    pFunc KeyRightCallback;
    pFunc KeySelectCheck;
    void(*KeySelectCallback[])(struct _textMenu_t *pTextMenu);
} textMenu_t, *pTextMenu_t;

extern u8g2_t u8g2;
extern textMenu_t textMenu;

void textMenu_Init(pTextMenu_t pTextMenu);
void textMenu_Handle(pTextMenu_t pTextMenu);

#endif

